cascading style sheets reference

Brought to you by Style Master CSS editor

What's New in CSS2?

The World Wide Web Consortium (W3C) introduced the CSS2 recommendation in October 1998. This amalgamated the CSS1 recommendation and the CSSP draft, and extended both with new concepts, new selectors and new properties. Here is a brief overview of what's new, with links to other parts of this guide which cover these in more detail.

New Concepts

Media

Web pages aren't just displayed on PC monitors. CSS2 allows different media (TVs, handheld devices and so on) to be targeted by one style sheet. Read our section on media for all the details.

Printing

CSS2 brings sophisticated printing options, that enable pages to be defined (size, margin, orientation), and allow control over page breaking and widow and orphan issues. You can even print crop marks. Read our section on printing for the full story.

Generated Content

CSS2 allows content o be inserted before or after elements. See the section on generated content for more.

New Selectors

CSS2 introduces several new selectors to give even more control over selecting elements on a page.

Child

Child selectors are similar to contextual selectors, but go a step further. With contextual selectors, an element must be a descendent of another element, but it might be deeply nested. Child selectors select only the direct children of an element.

First Child

Want to select only the first paragraph of a section? With the first child selector now you can.

Attribute

Attribute selectors are like class and id selectors on steroids. Select an element if it has any specified attribute set at all, or set to a specific value.

Adjacent

Adjacent selectors allow you to select elements that immediately follow other elements.

Row and column

With CSS2, any element can be a table or part of a table! The row and column selectors help select the rows and columns of a table.

New Properties

CSS2 introduces a number of new properties.

system fonts

font-family can now be specified as one of several system fonts. This helps build user interfaces that look like the target operating system.

font-size-adjust

Font sizes can now be adjusted so that when substitute fonts are used, the relative size of those fonts is much like that of the first choice font.

cursor

Control the shape of the cursor when it is over an element using the cursor property.

outline

create outlines around elements, using the new outline property.

text-shadow

Instead of relying on positioning to create text shadow effects, this property allows for built-in text shadows to be created using CSS2.